package com.yichi.detector;

// 状态管理
enum DetectionStage {
    BLINK_CHECK(0),
    HEAD_MOVEMENT_LEFT(1),
    HEAD_MOVEMENT_RIGHT(2),
    FINISH(3);

    private final int code;

    DetectionStage(int code) {
        this.code = code;
    }

    public static DetectionStage fromCode(int code) {
        for (DetectionStage stage : values()) {
            if (stage.code == code) {
                return stage;
            }
        }
        throw new IllegalArgumentException("Invalid code: " + code);
    }

    public int getCode() {
        return code;
    }
}
